<!--  -->
<template>
  <div></div>
</template>

<script>
// import * as DesignFunctions from '@/core/DesignFunctions.js'
import * as WindowType from '@/config/windowtype.js'
import * as PubsubType from '@/config/pubsubtype.js'
import VueFunctions from '@/core/VueFunctions.js'
import * as functions from '@/core/functions.js'
import PubSub from 'pubsub-js'
export default {
  created () {
    VueFunctions.method(WindowType.ADD_CUSTOM_HOME_PAGE, () => {
      PubSub.publish(PubsubType.PUBSUB_CHANGE_DESIGN_IFRAME_LOADING, true)
      // 请求后台进行添加一个home页面
      this.$post('/page/get-home-page-if-not-create').then(response => {
        if (response && response.id) {
          this.$store.dispatch('designSetIframePageId', response.id)
          PubSub.publish(PubsubType.PUBSUB_DESIGN_REFRESH_PAGE)
          // let src = DesignFunctions.getDesignPath(this.$store.state.host.id, this.$store.state.site.site.id, page[0].link)
          // if (src === this.currentIframeSrc) {
          //   src = src + '?' + new Date().getTime()
          // }
          // this.$store.dispatch('designSetIframeSrc', src)
          // this.closeDialog()

          // PubSub.publish(PubsubType.PUBSUB_REFRENCE_NAVIGATION_INFO, () => {
          //   // 修改当前设计页面的 pageId
          //   this.$store.dispatch('designSetIframePageId', response.id)
          //   PubSub.publish(PubsubType.PUBSUB_CHOOSE_NAVIGATION_PAGE_ACTION, { id: response.id })
          //   // 刷新页面部分的渲染
          //   // PubSub.publish(PubsubType.PUBSUB_DESIGN_REFRESH_PAGE)
          //   // 重新渲染页面的导航部分
          //   PubSub.publish(PubsubType.PUBSUB_RERENDER_NAVIGATION)
          // })
        }
      })
    })

    VueFunctions.method(WindowType.GOTO_URL_BACKEND_USER_PAGES, () => {
      let result = functions.routerPush('/backend/user/pages')
      this.$router.push(result)
    })
  },
  data () {
    return {
    }
  }
}

</script>
